typedef int Element;

struct Node {
	Element value;
	struct Node *left;
	struct Node *right;
	struct Node *parent;
};
typedef struct Node Tree_Node;

void insert(Tree_Node **proot, Element elem);
void deletefrom(Tree_Node **proot, Element elem);
Tree_Node *search(Tree_Node *root, Element elem);
int height(Tree_Node *root);
void destroy(Tree_Node *root);
void inorder(Tree_Node *, void (*visit)(Tree_Node *));
Tree_Node *minimum(Tree_Node *root);
Tree_Node *maximum(Tree_Node *root);
Tree_Node *successor(Tree_Node *node);
Tree_Node *predecessor(Tree_Node *node);
void left_rotate(Tree_Node **root, Tree_Node *node);
void right_rotate(Tree_Node **root, Tree_Node *node);
